﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package validation {

    public class GenericValidationConditionSet implements IGenericValidationCondition {

        public static const EVALUATE_AND:int = 0;
        public static const EVALUATE_OR:int = 1;

        protected var m_style:int;
        protected var m_conditions:Array;

        public function GenericValidationConditionSet(_arg1:int=0){
            this.m_conditions = new Array();
            super();
            this.m_style = _arg1;
        }
        public function add(_arg1:IGenericValidationCondition):void{
            this.m_conditions.push(_arg1);
        }
        public function evaluate(_arg1=null):Boolean{
            var _local2:Boolean;
            var _local3:IGenericValidationCondition;
            for each (_local3 in this.m_conditions) {
                switch (this.m_style){
                    case EVALUATE_AND:
                        _local2 = _local3.evaluate(_arg1);
                        if (!_local2){
                            return (_local2);
                        };
                        break;
                    case EVALUATE_OR:
                        _local2 = _local3.evaluate(_arg1);
                        if (_local2){
                            return (_local2);
                        };
                        break;
                };
            };
            return (_local2);
        }

    }
}//package validation 
